home *** CD-ROM | disk | FTP | other *** search
/ EnigmA Amiga Run 1996 June / EnigmA AMIGA RUN 08 (1996)(G.R. Edizioni)(IT)[!][issue 1996-06][EARSAN CD VII].iso / earcd / editor / gdphrc14.lha / ged-phrasecomp / misc / debug.h < prev    next >
C/C++ Source or Header  |  1996-04-11  |  2KB  |  81 lines

  1. #ifndef DEBUG_H
  2. #define DEBUG_H
  3.  
  4. /*
  5. ** $PROJECT: C debugging macros
  6. **
  7. ** $VER: debug.h 1.1 (02.09.95)
  8. **
  9. ** by
  10. **
  11. ** Stefan Ruppert , Windthorststrasse 5 , 65439 Floersheim , GERMANY
  12. **
  13. ** (C) Copyright 1994,1995
  14. ** All Rights Reserved !
  15. **
  16. ** $HISTORY:
  17. **
  18. ** 02.09.95 : 001.001 : added assert like macro DA()
  19. ** 31.03.94 : 000.001 : initial
  20. */
  21.  
  22. #ifdef __cplusplus
  23. extern "C" {
  24. #endif
  25.  
  26. #define bug      KPrintF
  27.  
  28. #ifdef DEBUG
  29.  
  30. #ifndef PROJECTNAME
  31. #define PROJECTNAME
  32. #endif
  33.  
  34. extern void KPrintF(char *fmt,...);
  35.  
  36. #define D(x)     x
  37. #define DBLINE    bug(PROJECTNAME __FILE__ "(%4ld):" __FUNC__ "() :",__LINE__)
  38. #define DB(x)   { DBLINE; \
  39.                         bug x; \
  40.                      }
  41.  
  42. #define DTL(x)  { struct TagItem *tstate = x; \
  43.                         struct TagItem *tag; \
  44.                         bug(__FILE__ "(%4ld):" __FUNC__ "() TagList :\n",__LINE__); \
  45.                         while((tag = NextTagItem(&tstate))) \
  46.                           bug("{0x%08lx,0x%08lx}\n",tag->ti_Tag,tag->ti_Data); \
  47.                      }
  48. #define DDL(x)  { struct Node *node; \
  49.                         bug(__FILE__ "(%4ld):" __FUNC__ "() ExecList :\n",__LINE__); \
  50.                         for(node = (x)->lh_Head; node->ln_Succ != NULL; node = node->ln_Succ) \
  51.                             bug("%lx : %s\n",node,node->ln_Name); \
  52.                      }
  53.  
  54. /* assert like macro */
  55. #define DA(x,expr)   { if(!(expr)) { DBLINE; bug("Fault: "); bug x; } }
  56.  
  57. #define DELAY(x)     Delay(x)
  58.  
  59. #define ENTERING  bug("entering " __FUNC__ "()\n")
  60. #define LEAVING   bug("leaving " __FUNC__ "()\n")
  61.  
  62. #else
  63.  
  64. #define D(x)
  65. #define DB(x)
  66. #define DA(x,expr)
  67. #define DELAY(x)
  68. #define DTL(x)
  69. #define DDL(x)
  70. #define ENTERING
  71. #define LEAVING
  72.  
  73. #endif
  74.  
  75. #ifdef __cplusplus
  76. };
  77. #endif
  78.  
  79. #endif   /* DEBUG_H */
  80.  
  81.